using System;
using System.Collections.Generic;
using System.Text;

namespace MapEditor
{
    public class Squad
    {
        public Soldier[] Soldiers;

        public Order Order;

        public int SquadLeader;
        //public bool IsSelected;



        public Squad()
        {

            //Soldiers = new Soldier[1];
            Order = new Order();
            //the first soldier is by default the squad leader
            SquadLeader = 0;
        }

        public bool NewOrder()
        {
            for (int looper=0;looper<Soldiers.Length;looper++)
            {
                Soldiers[looper].OrderCompleted = false;
                Soldiers[looper].NewOrder = true;
            }
            return true;
        }

        public bool CarryOutOrders()
        {
            int OrderCompleted = 0;
            //then go through all the soldiers
            for (int looper = 0; looper < this.Soldiers.Length; looper++)
            {
                this.Soldiers[looper].Think(this.Order);
                if (this.Soldiers[looper].OrderCompleted) { OrderCompleted++; };
            }
            if (OrderCompleted == this.Soldiers.Length)
            {
                this.Order.CurrentOrder = Order.OrderType.Hide;
            }
            return true;
        }

    }
}
